/*
 * @Description:
 * @Author: ldx
 * @Date: 2022-04-27 12:19:14
 * @LastEditors: ldx
 * @LastEditTime: 2022-09-29 23:18:34
 */
// import { BankOutlined } from '@ant-design/icons'
import React from 'react'
import { Outlet } from 'react-router-dom'

import u11 from '@/assets/u11.svg'
import u12 from '@/assets/u12.svg'
import u34 from '@/assets/u34.svg'
import u35 from '@/assets/u35.svg'
import u36 from '@/assets/u36.svg'
import u37 from '@/assets/u37.svg'
import u43 from '@/assets/u43.svg'
import u44 from '@/assets/u44.svg'
import u45 from '@/assets/u45.svg'
import u46 from '@/assets/u46.svg'
import u47 from '@/assets/u47.svg'
import Layout from '@/layout'
export const routes = [
  {
    path: '/database',
    key: 'database',
    redirect: '/database/material',
    icon: u44,
    title: '数据资料库',
    hideInMenu: false,
    component: Outlet,
    auth: ['/**', '/material/**', '/material/page', '/equip/**', '/equip/page'],
    routes: [
      {
        path: '/database/material',
        key: 'database.material',
        component: React.lazy(() => import('@/pages/database/material')),
        icon: u11,
        title: '信息资料',
        hideInMenu: false,
        auth: ['/**', '/material/**', '/material/page'],
        routes: []
      },
      {
        path: '/database/equip',
        key: 'database.equip',
        component: React.lazy(() => import('@/pages/database/equip')),
        icon: u12,
        title: '设备资料',
        hideInMenu: false,
        auth: ['/**', '/equip/**', '/equip/page'],
        routes: []
      }
    ]
  },
  {
    path: '/scenario',
    key: 'scenario',
    component: React.lazy(() => import('@/pages/scenario')),
    icon: u45,
    title: '想定库',
    hideInMenu: false,
    auth: ['/**', '/scenario-library/**', '/scenario-library/page'],
    routes: []
  },
  {
    path: '/homework',
    key: 'homework',
    redirect: '/homework/exam',
    icon: u47,
    title: '作业库',
    hideInMenu: false,
    component: Outlet,
    auth: [
      '/**',
      '/exam/**',
      '/exam/page',
      '/scenario-work/**',
      '/scenario-work/page'
    ],
    routes: [
      {
        path: '/homework/exam',
        key: 'homework.exam',
        component: React.lazy(() => import('@/pages/homework/exam')),
        icon: u46,
        title: '试题作业',
        hideInMenu: false,
        auth: ['/**', '/exam/**', '/exam/page'],
        routes: []
      },
      {
        path: '/homework/scenario',
        key: 'homework.scenario',
        component: React.lazy(() => import('@/pages/homework/scenario')),
        icon: u45,
        title: '想定作业',
        hideInMenu: false,
        auth: ['/**', '/scenario-work/**', '/scenario-work/page'],
        routes: []
      }
    ]
  },
  {
    path: '/systemManagement',
    key: 'systemManagement',
    redirect: '/systemManagement/user',
    icon: u43,
    title: '系统管理',
    hideInMenu: false,
    component: Outlet,
    auth: [
      '/**',
      '/user/**',
      '/user/page',
      '/role/**',
      '/role/page',
      '/access/**',
      '/access/page',
      '/audit-log/**',
      '/audit-log/page'
    ],
    routes: [
      {
        path: '/systemManagement/user',
        key: 'systemManagement.user',
        component: React.lazy(() => import('@/pages/setting/user')),
        icon: u36,
        title: '用户管理',
        hideInMenu: false,
        auth: ['/**', '/user/**', '/user/page'],
        routes: []
      },
      {
        path: '/systemManagement/role',
        key: 'systemManagement.role',
        component: React.lazy(() => import('@/pages/setting/role')),
        icon: u37,
        title: '角色管理',
        hideInMenu: false,
        auth: ['/**', '/role/**', '/role/page'],
        routes: []
      },
      {
        path: '/systemManagement/access',
        key: 'systemManagement.access',
        component: React.lazy(() => import('@/pages/setting/access')),
        icon: u34,
        title: '权限管理',
        hideInMenu: false,
        auth: ['/**', '/access/**', '/access/page'],
        routes: []
      },
      {
        path: '/systemManagement/log',
        key: 'systemManagement.log',
        component: React.lazy(() => import('@/pages/setting/log')),
        icon: u35,
        title: '日志管理',
        hideInMenu: false,
        auth: ['/**', '/audit-log/**', '/audit-log/page'],
        routes: []
      }
    ]
  },

  {
    /* 无匹配路由 放置在最后一个路由的位置 */
    path: '*',
    key: '*',
    hideInMenu: true,
    component: React.lazy(() => import('@/layout/404'))
  }
]
export default [
  {
    path: '/*',
    key: '/*',
    component: Layout,
    routes: routes
  },
  {
    path: '/login',
    key: 'login',
    component: React.lazy(() => import('@/pages/login'))
  },
  {
    path: '/register',
    key: 'register',
    component: React.lazy(() => import('@/pages/register'))
  }
]
export interface RoutesType {
  path: string
  redirect?: string
  key: string
  component?: any
  hideInMenu?: boolean
  icon?: string
  title?: string
  auth?: string[]
  routes?: RoutesType[]
  parent?: RoutesType
}
